/*
 * Name        : HttpEngineFactory.java
 * Classes     : HttpEngineFactory
 * Version     : 1.0
 * Date        : 2013-08-29
 *
 * Copyright 2013 CMCC.  All rights reserved.
 * This material, including documentation and any related computer
 * programs, is protected by copyright controlled by CMCC.  All
 * rights are reserved.  Copying, including reproducing, storing,
 * adapting or translating, any or all of this material requires the
 * prior written consent of CMCC.  This material also contains
 * confidential information which may not be disclosed to others
 * without the prior written consent of CMCC.
 */

package com.xgkj.diyiketang.http;

import java.security.InvalidParameterException;


/**
 * class name HttpEngineFactory.java
 * author renhaibin
 * date 2014-11-24 下午3:05:06
 *
 */
public class HttpEngineFactory {

    public enum HttpEngintType {
        HTTP_NETWORK_ENGINE,
        HTTP_LOCALFILE_ENGINE
    }

    public static HttpEngine createHttpEngine() {
        return HttpEngineFactory.createHttpEngine(HttpEngintType.HTTP_NETWORK_ENGINE);
    }

    public static HttpEngine createHttpEngine(HttpEngintType type) {

        HttpEngine httpEngine;

        switch (type) {
            case HTTP_NETWORK_ENGINE:
                httpEngine = new NetworkHttpEngine();
                break;
//            case HTTP_LOCALFILE_ENGINE:
//                httpEngine = new LocalFileHttpEngine();
//                break;
            default:
                throw new InvalidParameterException();
        }
        return httpEngine;
    }
}
